How to use MaxCDN with Gallery3? Need help with php code

bebebunny

Joined: 2013-04-21
Posts: 23
Posted: Tue, 2013-05-07 21:55

First off i dont know php, I need help inserting this line http://cdn.website.com just before the image file path..

Original views/photo.html.php:

Quote:
<div id="g-photo">
<?= $theme->resize_top($item) ?>
<? if (access::can("view_full", $item)): ?>
<a href="<?= $item->file_url() ?>" class="g-fullsize-link" title="<?= t("View full size")->for_html_attr() ?>">
<? endif ?>
<?= $item->resize_img(array("id" => "g-item-id-{$item->id}", "class" => "g-resize")) ?>
<? if (access::can("view_full", $item)): ?>
</a>
<? endif ?>
<?= $theme->resize_bottom($item) ?>
</div>

Here's what i did (adding http://cdn.website.com):

Quote:
<div id="g-photo">
<?= $theme->resize_top($item) ?>
<? if (access::can("view_full", $item)): ?>
<a href="http://cdn.website.com<?= $item->file_url() ?>" class="g-fullsize-link" title="<?= t("View full size")->for_html_attr() ?>">
<? endif ?>
<?= $item->resize_img(array("id" => "g-item-id-{$item->id}", "class" => "g-resize")) ?>
<? if (access::can("view_full", $item)): ?>
</a>
<? endif ?>
<?= $theme->resize_bottom($item) ?>
</div>

After resaving it and viewing page source, It turns out the image file still not pointed to cdn:

Quote:
PAGE SOURCE
<div id="g-photo">
<a href="http://cdn.website.com/gallery/var/albums/vacation2.png?m=1367890665" class="g-fullsize-link" title="View full size">
<img id="g-item-id-8602" class="g-resize" src="/gallery/var/resizes/vacation2.png?m=1367890665" alt="Vacation2 April-13-2013 000" width="598" height="369"/> </a>
</div>

I need to add this line http://cdn.website.com just before "/gallery/var/resizes/vacation3.png?m=1367890665"

I think this is the code that needs to be modified:

Quote:
<?= $item->resize_img(array("id" => "g-item-id-{$item->id}", "class" => "g-resize")) ?>
<? if (access::can("view_full", $item)): ?>

thx

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2013-05-07 22:07

have a look at the S3 module http://codex.galleryproject.org/Gallery3:Modules:aws_s3

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
bebebunny

Joined: 2013-04-21
Posts: 23
Posted: Wed, 2013-05-08 23:23

Isn't that module for Amazon S3?

Actually what i need to do is very simple.. basically insert http://cdn in the path of all image files.

From http:// website.com/gallery/var/resizes/album/image1.jpg to http://cdn.website.com/gallery/var/resizes/album/image1.jpg

I did read similar post, but no solution http://galleryproject.org/node/108056

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-05-09 01:06

look at the resize_img function in the item.php file of the models folder of the gallery module.
That function returns the img tag.
or better yet the resize_url function.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
jdorfman

Joined: 2013-05-10
Posts: 1
Posted: Fri, 2013-05-10 00:22

If any developers want to build a plugin for MaxCDN we will pay you. Please email me with your proposal: jdorfman at maxcdn dot com